//
//  Fraction.m
//  OC_数字,字典复习
//
//  Created by dllo on 15/12/7.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "Fraction.h"

@implementation Fraction

- (instancetype)initWithNum:(NSInteger)num
                       deno:(NSInteger)deno {
    self = [super init];
    if (self) {
        _num = num;
        _deno = deno;
    }
    return self;
}

- (Fraction *)addFraction:(Fraction *)fraction {
    Fraction *newFrac = [[Fraction alloc] init];
    
    /** 新分数分子 */
    newFrac.num = self.num * fraction.deno + fraction.num * self.deno;
    
    /** 新分数分母 */
    newFrac.deno = self.deno * fraction.deno;
    return newFrac;
}

























@end
